import Vue from 'vue';
import Router from 'vue-router';
import Module1 from './module1'
import Module2 from './module2'
import Area from './area'

Vue.use(Router);

export default new Router({
    // mode: 'history',
    routes: [
        {
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: resolve => require(['../components/common/Home.vue'], resolve),
            meta: { title: '自述文件' },
            children:[
                {
                    path: '/dashboard',
                    component: resolve => require(['../components/page/Dashboard.vue'], resolve),
                    meta: { title: '系统首页' }
                },
                {
                    path: '/icon',
                    component: resolve => require(['../components/page/Icon.vue'], resolve),
                    meta: { title: '自定义图标' }
                },
                {
                    path: '/module1/index',
                    component: resolve => require(['../components/module1/Index'], resolve),
                    meta: { title: '权限管理' },
                    children: Module1
                },
                {
                    path: '/module2/index',
                    component: resolve => require(['../components/module2/Index'], resolve),
                    meta: { title: '系统设置' },
                    children: Module2
                },
                {
                    path: '/area/index',
                    component: resolve => require(['../components/area/Index'], resolve),
                    meta: { title: '小区管理' },
                    children: Area
                },
            ]
        },
        {
            path: '/login',
            component: resolve => require(['../components/page/Login.vue'], resolve)
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
})
